<?php

/**
 * @author Rizky Tahara Shita
 * @website http://tahara.web.id
 * @email rizky.tahara@gmail.com
 * @copyright b'IT Cyber Solution
 */

require_once(APPPATH.'controllers/admin/applications.php');
class Statistic extends Applications
{
	public function __construct()
	{
		parent::__construct();

		/**
		 * @description check the session variables
		 */
		$this->M_login->session_check();

		/**
		 * @description the URL
		 */
		$this->bz_segment['END'] = 5;
		$this->bz_segment['URL'] = $this->M_functions->segment_create();
		$this->bz_segment['SITE_URL'] = site_url($this->bz_segment['URL']);

		/**
		 * @description access rights
		 */
		$this->access_rights = $this->M_menu->valid_check('db_default', $this->session->userdata('session_user_id'));
		$this->access_rights = array
			(
				'ADD' => in_array('add', $this->access_rights) ? TRUE : FALSE
				, 'EDIT' => in_array('edit', $this->access_rights) ? TRUE : FALSE
				, 'DELETE' => FALSE
			);

		/**
		 * @description initialize variables for database
		 */
		$this->tbl_attr = array
			(
				'TABLE' => array
					(
						'NAME' => 'hris_organization_company_structure a'
						, 'NAME_ALIAS' => 'hris_organization_company_structure a'
						, 'PRIMARY' => array
							(
								'SHOW' => FALSE
								, 'DATA' => array('id', 'hidden__employee_data_id')
							)
					)
				, 'TABLE_MODAL' => array
					(
						'NAME' => 'hris_employee_attendance'
						, 'NAME_ALIAS' => 'hris_employee_attendance b'
						, 'PRIMARY' => array
							(
								'SHOW' => FALSE
								, 'DATA' => array('date_in', 'data__id')
							)
					)
				, 'VIEW' => array
					(
						'HEADING' => array
							(
								$this->lang->line('hris_employee_number')
								, $this->lang->line('hris_name')
								, $this->lang->line('hris_schema_position')
								, $this->access_rights['DELETE'] ? '&nbsp;' : NULL
							)
						, 'FIELDS' => ''
						, 'FIELDS_EDIT' => ''
						, 'FIELDS_ORDER' => ''
						, 'FIELDS_PARENT_NAME' => ''
						, 'TABLE' => array
							(
								'WHERE' => array()
							)
					)
				, 'VIEW_DETAIL' => array
					(
						'HEADING' => array
							(
								$this->lang->line('hris_date')
								, $this->lang->line('hris_start')
								, $this->lang->line('hris_end')
								, $this->lang->line('hris_attendance_shift_daily') . ' ' . $this->lang->line('hris_start')
								, $this->lang->line('hris_attendance_shift_daily') . ' ' . $this->lang->line('hris_end')
								, $this->lang->line('hris_attendance_entry_late')
								, $this->lang->line('hris_attendance_entry_earlyout')
								, $this->lang->line('hris_status')
								, $this->access_rights['DELETE'] ? '&nbsp;' : NULL
							)
						, 'FIELDS' => 'date_in, data__id,'
								. ', DATE_FORMAT(date_in_year, "%W, %d %M %Y") as date, time_in, time_out, shift_daily_time_start, shift_daily_time_end, '
								. ', timediff(time_in, shift_daily_time_start ) as late, timediff(time_out, shift_daily_time_end) as earlyout, '
								. ', (select name from bz_hris_attendance_status where id = b.attendance_status__id) as attendance_status_name'
						, 'FIELDS_EDIT' => ''
						, 'FIELDS_ORDER' => 'date_in_year'
					)
				, 'FORM' => array
					(
						'FIELDS' => 'concat(`fn_hris_employee_number_current`(id), " - ", `fn_hris_employee_name_get`(id)) as employee_data'
						, 'FIELDS_ORDER' => ''
						, 'COLUMN' => 2
					)
				, 'URL' => array
					(
						'FORM' => $this->bz_segment['SITE_URL'].'/form'
						, 'VIEW' => $this->bz_segment['SITE_URL'].'/view'
					)
			);

		$this->tbl_viewdetail_attr = array
			(
				'JAVASCRIPT' => array
					(
						'VIEWLIST_GENERATE' => array
								(
									'JS_FUNCTION_NAME' => 'js_modaldialog_data_put'
									, 'JS_FUNCTION_PARAMETERS' => '"'.$this->bz_segment['SITE_URL'].'/ajx_live_form_detail", "frm_modal", "txt1", "txt72", "js_modal_functions", "'.$this->bz_segment['SITE_URL'].'", "ajx_modal_data_", "put"'
								)
					)
			);

		/**
		 * @description template lite variables
		 */
		$this->bz_tlite_var['CACHE_PATH'] = $this->bz_tlite_var['SESSION']['USER_ID'].'|'.str_replace('/', '|', $this->bz_segment['URL']);
		$this->bz_tlite_var['CACHE'] = array
			(
				'PUBLIC' => $this->bz_tlite_var['SESSION']['USER_ID']
				, 'PRIVATE' => array
					(
						'GLOBAL' => $this->bz_tlite_var['CACHE_PATH']
						, 'VIEW' => $this->bz_tlite_var['CACHE_PATH'].'|view'
						, 'FORM' => $this->bz_tlite_var['CACHE_PATH'].'|form'
					)
			);
	}


	/**
	 * @function index()
	 * @description main controller
	 */
	public function index()
	{
		/**
		 * @description choose which controller to show
		 */
		redirect($this->tbl_attr['URL']['VIEW']);
	}


	/**
	 * @function view()
	 * @description view table list of data
	 */
	public function view()
	{
		if ($this->web_data['BISKITZ']['HEADER']['BROWSER_SUPPORTED'] == '')
		{
			/**
			 * @description load the models
			 */
			$this->load->model('admin/hris/HRIS_M_attendance_statistic');


			/**
			 * @description if there isn't any css/ajax cache, build it! else show cache!
			 */
			if ( ! $this->bz_tlite->is_cached($this->bz_tlite_var['NAMES']['CSS'], $this->bz_tlite_var['CACHE']['PRIVATE']['VIEW']))
			{
				/**
				 * @section begin page init
				 */
					/**
					 * @description show the menu
					 */
					$menu = $this->M_menu->shows();
					$this->web_data['JAVASCRIPT_MENU'] = $menu['JAVASCRIPT_MENU'];
					$this->web_data['PAGE']['MENU'] = $menu['PAGE']['MENU'];

					/**
					 * @description init the css and the ajax needed
					 */
					$css_files = array
						(
							array('layout' => 'screen')
							, array('tipsy/tipsy' => 'screen')
							, array('form_icon_bar' => 'screen')
							, array('nanoscroller/nanoscroller' => ($menu['PAGE']['MENU']['FAVORITE']['LIST'] != 'Error') ? 'screen' : NULL)
							, array('shortcut_bar' => ($menu['PAGE']['MENU']['FAVORITE']['LIST'] != 'Error') ? 'screen' : NULL)
							, array('ddm/multi-ddm' => 'screen')
						);
					$js_files = array
						(
							'js/plugins/ddm' => array('jquery.multi-ddm.pack')
							, 'js/plugins/nanoscroller' => ($menu['PAGE']['MENU']['FAVORITE']['LIST'] != 'Error') ? array('jquery.nanoscroller.min', 'overthrow.min') : NULL
							, 'js/plugins/tipsy' => array('jquery.tipsy.pack')
							, $this->web_data['BISKITZ']['SETTINGS']['BISKITZ_JS_FUNCTIONS_PATH'] => array('common', 'form', 'error')
							, 'themes/'.$this->web_data['BISKITZ']['SETTINGS']['BISKITZ_THEME_ADMIN'].'/'.$this->web_data['BISKITZ']['SETTINGS']['BISKITZ_JS_PATH'] => array('common')
						);
				/**
				 * @section end page init
				 */


				/**
				 * @section begin generate template variables
				 */
					/**
					 * @description css and ajax
					 */
					$this->web_data['PAGE']['CSS_FILES'] = $this->M_template->css_generate($css_files, $this->web_data['BISKITZ']['SETTINGS']['BISKITZ_THEME_ADMIN']);
					$this->web_data['PAGE']['JAVASCRIPT_FILES'] = $this->M_template->js_generate($js_files);

					/**
					 * @description initialize the additional javascript
					 */
					if ($menu['PAGE']['MENU']['FAVORITE']['LIST'] != 'Error')
					{
						$this->web_data['JAVASCRIPT'] .= '
							<script>
								$(function()
								{
									$(".nano").nanoScroller({preventPageScrolling: true});
								});
							</script>
							';
					}

					/**
					 * @description menu descriptions
					 */
					$this->web_data['PAGE']['DETAIL'] = $this->M_menu->detail();
				/**
				 * @section end generate template variables
				 */
			}


			/**
			 * @section begin table view init
			 */
				/**
				 * @description init the command button
				 */
				$view_list_commands = '';

				/**
				 * @description init the table list
				 */
				$view_list_content = $this->HRIS_M_attendance_statistic->viewlist_generate('db_default', array(), $this->session->userdata('session_hris_employee_structure_id'));
				if (count($view_list_content))
				{
					$this->table->set_heading($this->tbl_attr['VIEW']['HEADING']);
					$view_list_content = $this->table->generate($view_list_content);
				}
				else
				{
					$view_list_content = '<center class="error_field">'.$this->lang->line('data_view_error').'</center>';
				}
			/**
			 * @section end table view init
			 */


			/**
			 * @section begin generate template variables
			 */

				/**
				 * @description view list
				 */
				$this->web_data['PAGE']['VIEW'] = array
					(
						'FORM' => array
							(
								'OPEN' => form_open($this->tbl_attr['URL']['VIEW'], array('id' => 'frm_header', 'onSubmit' => 'return false'), '')
							)
						, 'COMMANDS' => $view_list_commands
						, 'LISTS' => $view_list_content
					);
			/**
			 * @section end generate template variables
			 */


			/**
			 * @description log the action!
			 */
			$this->M_log->write
				(
					'db_default'
					, sprintf($this->lang->line('log_view_access'), $this->router->class)
				);



		}
		else
		{
			/**
			 * @section Browser NOT Supported
			 */
				/**
				 * @description browser not supported message error
				 */
				$css_files = array(array('layout' => 'screen'));


				/**
				 * @section begin generate template variables
				 */
					/**
					 * @description css and ajax
					 */
					$this->web_data['PAGE']['CSS_FILES'] = $this->M_template->css_generate($css_files, $this->web_data['BISKITZ']['SETTINGS']['BISKITZ_THEME_ADMIN']);
				/**
				 * @section end generate template variables
				 */

		}



		/**
		 * @description output template variables
		 */
		$this->bz_tlite->assign('WEB_DATA', $this->web_data);


		/**
		 * @section begin output
		 */
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['HEADER'], $this->bz_tlite_var['CACHE']['PUBLIC']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['CSS'], $this->bz_tlite_var['CACHE']['PRIVATE']['VIEW']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['MENU'], $this->bz_tlite_var['CACHE']['PUBLIC']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['CONTENT_DESCRIPTION'], $this->bz_tlite_var['CACHE']['PRIVATE']['GLOBAL']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['CONTENT_FORM_COMMAND_BAR'], $this->bz_tlite_var['CACHE']['PRIVATE']['VIEW']);

		$this->bz_tlite->cache = FALSE;
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['CONTENT_FORM']);

		$this->bz_tlite->cache = TRUE;
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['CONTENT_SHORTCUT_BAR'], $this->bz_tlite_var['CACHE']['PUBLIC']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['FOOTER'], $this->bz_tlite_var['CACHE']['PUBLIC']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['JAVASCRIPT'], $this->bz_tlite_var['CACHE']['PRIVATE']['VIEW']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['FOOTER_END'], $this->bz_tlite_var['CACHE']['PUBLIC']);
		/**
		 * @section end output
		 */
	}


	/**
	 * @function form()
	 * @description form for data entry
	 */
	public function form($prm_structure_id = '', $prm_data_id = '')
	{
		if ($this->web_data['BISKITZ']['HEADER']['BROWSER_SUPPORTED'] == '')
		{
			/**
			 * @description if the user has ADD or EDIT access, show the form!
			 */
			if ($this->access_rights['ADD'] OR ($this->access_rights['EDIT'] && trim($prm_structure_id) != '' && trim($prm_data_id) != ''))
			{
				/**
				 * @description if there isn't any css/ajax cache, build it! else show cache!
				 */
				if ( ! $this->bz_tlite->is_cached($this->bz_tlite_var['NAMES']['CSS'], $this->bz_tlite_var['CACHE']['PRIVATE']['FORM']))
				{
					/**
					 * @section begin page init
					 */
						/**
						 * @description show the menu
						 */
						$menu = $this->M_menu->shows();
						$this->web_data['JAVASCRIPT_MENU'] = $menu['JAVASCRIPT_MENU'];
						$this->web_data['PAGE']['MENU'] = $menu['PAGE']['MENU'];

						/**
						 * @description init the css and the ajax needed
						 */
						$css_files = array
							(
								array('layout' => 'screen')
								, array('tipsy/tipsy' => 'screen')
								, array('validate/validate' => 'screen')
								, array('form_icon_bar' => 'screen')
								, array('nanoscroller/nanoscroller' => ($menu['PAGE']['MENU']['FAVORITE']['LIST'] != 'Error') ? 'screen' : NULL)
								, array('shortcut_bar' => ($menu['PAGE']['MENU']['FAVORITE']['LIST'] != 'Error') ? 'screen' : NULL)
								, array('dynDateTime/dynDateTime' => 'screen')
								, array('ddm/multi-ddm' => 'screen')
							);
						$js_files = array
							(
								'js/plugins/ddm' => array('jquery.multi-ddm.pack')
								, 'js/plugins/nanoscroller' => ($menu['PAGE']['MENU']['FAVORITE']['LIST'] != 'Error') ? array('jquery.nanoscroller.min', 'overthrow.min') : NULL
								, 'js/plugins/validate' => array('jquery.validate.pack', 'jquery.metadata')
								, 'js/plugins/date' => array('date')
								, 'js/plugins/tipsy' => array('jquery.tipsy.pack')
								, 'js/plugins/dynDateTime' => array('jquery.dynDateTime.pack')
								, 'js/plugins/dynDateTime/lang/pack' => array('calendar-'.$this->session->userdata('session_user_language_abbr'))
								, $this->web_data['BISKITZ']['SETTINGS']['BISKITZ_JS_FUNCTIONS_PATH'] => array('common', 'form', 'error', 'datetime_picker')
								, 'themes/'.$this->web_data['BISKITZ']['SETTINGS']['BISKITZ_THEME_ADMIN'].'/'.$this->web_data['BISKITZ']['SETTINGS']['BISKITZ_JS_PATH'] => array('common')
							);


						/**
						 * @section begin form initialize
						 */
							/**
							 * @description initialize the form elements
							 */
							$form_content = array
								(
									'<b>'.$this->lang->line('hris_name').'</b>'
									, '<span id="txt0" class="bold"></span>'

									, '<b>'.$this->lang->line('hris_period').'</b>'
									, form_input
										(
											array
											(
												'name' => 'txtinput[1]', 'id' => 'txt1'
												, 'size' => '11', 'maxlength' => '10'
												, 'readOnly' => 'readOnly', 'class' => '{validate: {required: true}} input_calendar do_not_change'
											)
											, ''
											, 'onBlur="javascript: calendar.hide();"'
										)
										. '&nbsp;' . $this->lang->line('hris_to') . '&nbsp;'
										. form_input
											(
												array
												(
													'name' => 'txtinput[2]', 'id' => 'txt2'
													, 'size' => '11', 'maxlength' => '10'
													, 'readOnly' => 'readOnly', 'class' => '{validate: {required: true}} input_calendar do_not_change'
												)
												, ''
												, 'onBlur="javascript: calendar.hide();"'
											)


										. form_submit
											(
												array
												(
													'id' => 'btn_search', 'class' => 'input_not_default input_no_margin'
													, 'shortcut_f2' => $this->tbl_attr['URL']['VIEW']
												)
												, $this->lang->line('button_search')
											)
								);

							/**
							 * @description create the form and elements
							 */
							$table_template = array('table_open' => '<table class = "plain">');
							$this->table->set_template($table_template);

							$form_content = $this->table->make_columns($form_content, $this->tbl_attr['FORM']['COLUMN']);
							$form_content = $this->table->generate($form_content);
						/**
						 * @section end form initialize
						 */
					/**
					 * @section end page init
					 */



					/**
					 * @section begin generate template variables
					 */
						/**
						 * @description css and ajax
						 */
						$this->web_data['PAGE']['CSS_FILES'] = $this->M_template->css_generate($css_files, $this->web_data['BISKITZ']['SETTINGS']['BISKITZ_THEME_ADMIN']);
						$this->web_data['PAGE']['JAVASCRIPT_FILES'] = $this->M_template->js_generate($js_files);

						/**
						 * @description initialize the additional javascript
						 */
						$this->web_data['JAVASCRIPT'] .= '
							<script>
								$(function()
								{
									js_data_put =
									"
										js_form_action
										(
											\"'.$this->bz_segment['SITE_URL'].'\", \"ajx_data_\", \"put\", \"'.$prm_structure_id.'/'.$prm_data_id.'\"
											, \"#frm_header\", \"#process\", \"#error_message\"
										);
									";

									$("#btn_search").click
										(function()
										{
											eval(js_data_put);
										});

									js_datetime_picker_show("txt1", "txt2");
									js_datetime_picker_show("txt2", "btn_search");

									$("#txt1").val(Date.today().toString("yyyy-MM-01"));
									$("#txt2").val(Date.today().toString("yyyy-MM-dd"));
									$("#btn_search").focus().select();
						';

						if ($menu['PAGE']['MENU']['FAVORITE']['LIST'] != 'Error')
						{
							$this->web_data['JAVASCRIPT'] .= '$(".nano").nanoScroller({preventPageScrolling: true});';
						}

						$this->web_data['JAVASCRIPT'] .= '
								});
							</script>
						';

						/**
						 * @description menu descriptions
						 */
						$this->web_data['PAGE']['DETAIL'] = $this->M_menu->detail();

						/**
						 * @description icon bar
						 */
						$this->load->model('admin/M_command_bar');
						$this->web_data['PAGE']['ICON_BAR'] = $this->M_command_bar->form('TRUE', FALSE, FALSE, FALSE, FALSE);

						/**
						 * @description form dialogs
						 */
						$this->web_data['PAGE']['FORM'] = array
							(
								'OPEN' => form_open('', array('id' => 'frm_header', 'onSubmit' => 'return false'), '')
								, 'CONTENT' => $form_content
								, 'CENTER' => 'FALSE'
							);

						/**
						 * @description notes
						 */
						$this->web_data['PAGE']['NOTES'] = array
							(
								'USE' => 'TRUE'
								, 'MESSAGE' => array
									(
										'SHORTCUTS' => $this->lang->line('notes_shortcuts')
										, 'ADDITIONAL' => $this->lang->line('notes_additional')
									)
							);
					/**
					 * @section end generate template variables
					 */
				}


				/**
				 * @description get the data for editing via ajax
				 */
				if ($this->access_rights['EDIT'] && trim($prm_structure_id) != '' && trim($prm_data_id) != '')
				{
					$this->web_data['JAVASCRIPT_EXTEND'] = '
						<script>
							$(function()
							{
								eval(js_data_put);
							});
						</script>
					';
				}


				/**
				 * @description log the action!
				 */
				$this->M_log->write('db_default', sprintf($this->lang->line('log_form_access'), $this->router->class, 'form'));
			}
			else
			{
				/**
				 * @description doesn't have ADD or EDIT access? redirect to desktop
				 */
				redirect('admin/desktop');
			}



		}
		else
		{
			/**
			 * @section Browser NOT Supported
			 */
				/**
				 * @description browser not supported message error
				 */
				$css_files = array(array('layout' => 'screen'));


				/**
				 * @section begin generate template variables
				 */
					/**
					 * @description css and ajax
					 */
					$this->web_data['PAGE']['CSS_FILES'] = $this->M_template->css_generate($css_files, $this->web_data['BISKITZ']['SETTINGS']['BISKITZ_THEME_ADMIN']);
				/**
				 * @section end generate template variables
				 */
		}



		/**
		 * @description output template variables
		 */
		$this->bz_tlite->assign('WEB_DATA', $this->web_data);


		/**
		 * @section begin output
		 */
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['HEADER'], $this->bz_tlite_var['CACHE']['PUBLIC']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['CSS'], $this->bz_tlite_var['CACHE']['PRIVATE']['FORM']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['MENU'], $this->bz_tlite_var['CACHE']['PUBLIC']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['CONTENT_DESCRIPTION'], $this->bz_tlite_var['CACHE']['PRIVATE']['GLOBAL']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['CONTENT_FORM_ICON_BAR'], $this->bz_tlite_var['CACHE']['PRIVATE']['FORM']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['CONTENT_FORM'], $this->bz_tlite_var['CACHE']['PRIVATE']['FORM']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['CONTENT_SHORTCUT_BAR'], $this->bz_tlite_var['CACHE']['PUBLIC']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['FOOTER'], $this->bz_tlite_var['CACHE']['PUBLIC']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['JAVASCRIPT'], $this->bz_tlite_var['CACHE']['PRIVATE']['FORM']);

		$this->bz_tlite->cache = FALSE;
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['JAVASCRIPT_EXTEND']);

		$this->bz_tlite->cache = TRUE;
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['FOOTER_END'], $this->bz_tlite_var['CACHE']['PUBLIC']);
		/**
		 * @section end output
		 */
	}



/**
 * @section AJAX Action Section
 */

	/**
	 * @function ajx_data_put()
	 * @description get the data from database and put them to the form via ajax!
	 */
	public function ajx_data_put($prm_structure_id = '', $prm_data_id = '')
	{
		if ($this->input->is_ajax_request() && $this->access_rights['EDIT'] && trim($prm_structure_id) != '' && trim($prm_data_id) != '')
		{
			/**
			 * @description load the models
			 */
			$this->load->model(array('admin/M_live_data', 'admin/hris/HRIS_M_attendance_statistic'));
			/**
			 * @description load the helper
			 */
			$this->load->helper('viewlist');


			$employee_valid = $this->HRIS_M_attendance_statistic->viewlist_generate('db_default', array(), $this->session->userdata('session_hris_employee_structure_id'));
			$employee_valid = array_key_exists($prm_data_id, $employee_valid);
			if ($employee_valid === TRUE)
			{
				$return_value = $this->M_live_data->put
					(
						'db_default'
						, 'hris_employee_data'
						, array('id' => $prm_data_id)
						, $this->tbl_attr['FORM']['FIELDS'] . ', "' . $this->input->post('txtinput[1]') . '", "' . $this->input->post('txtinput[2]') . '"'
						, 0, 'log_form_edit', 'form'

						, 'js_action_data_detail'
						, array
							(
								'FUNCTION_NAME' => 'detail_generate'
								, 'FUNCTION_ATTR' => array
									(
										'db_default'
										, array_merge
											(
												array
													(
													 'NAME' => array
															(
																'SOURCE' => $this->tbl_attr['TABLE_MODAL']['NAME_ALIAS']
																, 'JOIN' => array
																	(
																		array
																			(
																				'TABLE' => 'bz_hris_attendance_date_in_year c'
																				, 'KEYS' => 'b.date_in = c.date_in_year and (data__id = "'.$prm_data_id.'" or data__id is null)'
																				, 'TYPE' => 'RIGHT'
																			)
																	)
															)
													, 'PRIMARY' => $this->tbl_attr['TABLE_MODAL']['PRIMARY']
													, 'HEADING' => $this->tbl_attr['VIEW_DETAIL']['HEADING']
													, 'FIELDS' => array
															(
																	'NAME' => $this->tbl_attr['VIEW_DETAIL']['FIELDS']
																	, 'CAPTION' => $this->tbl_attr['VIEW_DETAIL']['FIELDS_EDIT']
																	, 'ORDER' => $this->tbl_attr['VIEW_DETAIL']['FIELDS_ORDER']
															)
													)

												, $this->tbl_viewdetail_attr
											)
#										, $this->tbl_viewdetail_attr
										, '(data__id = "'.$prm_data_id.'" or data__id is null) and date_in_year between "' . $this->input->post('txtinput[1]') . '" and "' . $this->input->post('txtinput[2]') . '"'
										, $this->tbl_viewdetail_attr['JAVASCRIPT']['VIEWLIST_GENERATE']
									)
							)
					);
			}
			else
			{
				$return_value = array
					(
						'js_action_message'
						, array($this->lang->line('hris_msg_request_statistic_no_access'), 'error', $this->tbl_attr['URL']['VIEW'])
					);
			}


			$return_value = json_encode($return_value);
			echo $return_value;
		}
	}



}

/** End of file statistic.php */
/** Location: ./biskitz_mpc/biskitz/controllers/admin/hris/attendance/presence/statistic.php */
